package com.api.shopapi.service.impl;

import com.api.shopapi.entity.DeviceYjsbjian;
import com.api.shopapi.entity.dto.DeviceQzXuetangyiDTO;
import com.api.shopapi.entity.dto.DeviceYjsbjianDTO;
import com.api.shopapi.mapper.DeviceYjsbjianMapper;
import com.api.shopapi.service.DeviceYjsbjianService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("DeviceYjsbjianServiceImplOne")
public class DeviceYjsbjianServiceImpl implements DeviceYjsbjianService {

    @Autowired
    private DeviceYjsbjianMapper deviceYjsbjianMapper;

    @Override
    public int insert(DeviceYjsbjian deviceYjsbjian) {
        return deviceYjsbjianMapper.insert(deviceYjsbjian);
    }

    @Override
    public int update(DeviceYjsbjian deviceYjsbjian) {
        return deviceYjsbjianMapper.update(deviceYjsbjian);
    }

    @Override
    public DeviceYjsbjian getByUserCode(String userCode) {
        return deviceYjsbjianMapper.getByUserCode(userCode);
    }

    @Override
    public DeviceYjsbjian getByDeviceId(String deviceId) {
        return deviceYjsbjianMapper.getByDeviceId(deviceId);
    }

    @Override
    public PageInfo<DeviceYjsbjianDTO> getPage(int pageIndex, int pageSize, String phone, String deviceId) {
        PageHelper.startPage(pageIndex,pageSize);
        List<DeviceYjsbjianDTO> deviceQzXuetangyiDTOList = deviceYjsbjianMapper.getPage(phone, deviceId);
        return new PageInfo<>(deviceQzXuetangyiDTOList);
    }
}
